<template>
	<view>
		<navbar :parameter='parameter'></navbar>

		<view class="top-box">
			<view class=""> 可提现金额（元） </view>
			<view class="number">￥<text>{{commission}}</text> </view>
		</view>
		<view class="wap">
			<view class="box">
				<view class=""> 提现金额 </view>
				<view class="input-line acea-row row-bottom">
					<text>￥</text>
					<input type="number" v-model="amount" value="" />
					<view class="" @click="amount = commission"> 全部提现 </view>
				</view>
				<view class="btn-box">
					<view class="btn" @click="submit">申请提现</view>
				</view>
				<view class="tips">
					注：此处提现是提现佣金到余额，提现最低限额为10元
				</view>
			</view>
		</view>

		<!-- 提示 -->
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	let app = getApp();
	export default {
		data() {
			return {
				parameter: {
					'navbar': '1',
					'return': '1',
					'title': '我的佣金',
					'color': true,
					'class': 'transparent'
				},
				commission: '0.00',
				amount: '',
			};
		},
		onLoad(option) {
			this.commission = option.commission
		},
		onShow() {

		},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {

		},
		onShareTimeline(res) { //分享到朋友圈

		},
		methods: {
			async submit() {
				if(!this.amount){
					this.$refs.uToast.show({
						type: 'error',
						message: '请输入提现金额'
					})
					return;
				}
				const res = await this.$myRequest({
					url: '/api/fslt/applyWithdraw',
					data: {
						openid: uni.getStorageSync('openid'),
						money: this.amount
					}
				})
				if (res.data.status == 200) {
					this.$refs.uToast.show({
						type: 'success',
						message: '提交成功',
						complete() {
							uni.navigateBack({
								delta:2
							})
						}
					})
				}
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.top-box {
		position: absolute;
		left: 0;
		width: 100%;
		top: 0;
		z-index: 1;
		background: linear-gradient(-85deg, #1F83FF, #61B1FF);
		height: 500rpx;
		padding: 30rpx;
		padding-top: 180rpx;
		color: #fff;
	}

	.top-box .number {
		font-size: 36rpx;
		margin-top: 30rpx;
	}

	.top-box .number text {
		font-size: 70rpx;
	}

	.wap {
		position: absolute;
		left: 0;
		width: 100%;
		top: 350rpx;
		padding: 30rpx;
		z-index: 2;
	}

	.box {
		background-color: #fff;
		border-radius: 18rpx;
		padding: 30rpx;
		padding-bottom: 60rpx;
	}

	.input-line {
		margin: 40rpx 0;
		border-bottom: 1px solid #E3E3E3;
		padding-bottom: 30rpx;
	}

	.input-line text {
		color: #020202;
		font-size: 80rpx;
		line-height: 1;
	}

	.input-line input {
		flex: 1;
		font-size: 36rpx;
	}

	.input-line view {
		color: #2185FF;
		font-size: 28rpx;
	}

	.account {
		height: 100rpx;
		border-bottom: 1px solid #E3E3E3;
		margin-top: 20rpx;
	}

	.btn-box {
		padding-top: 60rpx;
		padding-bottom: 30rpx;
	}

	.btn-box .btn {
		width: 100%;
		height: 80rpx;
		border-radius: 10rpx;
		line-height: 80rpx;
		text-align: center;
		background-color: #1F83FF;
		color: #fff;
		font-size: 32rpx;
	}

	.tips {
		font-size: 24rpx;
	}
</style>
